﻿#ifndef JCURVE_H
#define JCURVE_H

#include "jcurve_global.h"
#include "qwt_plot_curve.h"

class JCURVE_EXPORT JCurve : public QwtPlotCurve
{
public:
    explicit JCurve(const QString &title);

    void setSize(size_t size);
    size_t size() { return q_points.size(); }
    void append(const QPointF &point);
    void append(qreal y);
    void append(qreal x, qreal y);
    void setSamples(const QVector<QPointF> &samples);
    void shift(const QPointF &point);
    void shift(qreal y);
    void shift(qreal x, qreal y);
    int count() const { return q_points.count(); }
    QVector<QPointF> &samples() { return q_points; }

    int shiftCount() const { return q_shiftCount; }
    void setShiftCount(int value) { q_shiftCount = value; }

    void setLinePen(const QPen& pen);
    void setColor(const QColor &color);

    void clear();
    void update();

    enum { Rtti_Curve = QwtPlotCurve::Rtti_PlotUserItem + 1 };
    virtual int rtti() const;

    void setCurveStyle(int curveStyle);

private:
    void init();

private:
    int q_shiftCount;
    QVector<QPointF> q_points;
};

#endif // JCURVE_H
